import React from 'react';
import BreadcrumbCustom from '../../BreadcrumbCustom';
import {Row, Tabs} from 'antd';
import LimitIPTable from "./LimitIPTable";
import * as config from '../../../axios/config';
import * as Request from '../../../Server/Upgrade';
require('./commonInfo.css');
const TabPane = Tabs.TabPane;

class LimitIP extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            activeKey : '1'
        };
    }

    changeTab = (activeKey) => {
        this.setState({activeKey});
    }

    render(){
        return (
            <div>
                <Row>
                    <BreadcrumbCustom first={'限制IP表'}/>
                </Row>
                <Row style={{paddingTop:5}}>
                    <Tabs activeKey={this.state.activeKey} type={'card'} onChange={this.changeTab}>
                        <TabPane tab={'允许IP表'} key={'1'}>
                            <LimitIPTable
                                page={Request.allowIPsPage}
                                saveOrEdit={Request.allowIPSaveOrEdit}
                                find = {Request.allowIPGetById}
                                delete = {Request.allowIPDeleteById}
                                importUrl = {config.ALLOW_IP_IMPORT}
                                export = {Request.allowIPExport}
                                title = {'允许IP'}
                            />
                        </TabPane>
                        <TabPane tab={'拒绝IP表'} key={'2'}>
                            <LimitIPTable
                                page={Request.denyIPsPage}
                                saveOrEdit={Request.denyIPSaveOrEdit}
                                find = {Request.denyIPGetById}
                                delete = {Request.denyIPDeleteById}
                                importUrl = {config.DENY_IP_IMPORT}
                                export = {Request.denyIPExport}
                                title = {'拒绝IP'}
                            />
                        </TabPane>
                    </Tabs>
                </Row>
            </div>
        );
    }
}

export default LimitIP;